package com.czl.websocket.controller.api;

import com.czl.common.mvc.RestApiResult;
import com.czl.websocket.server.ChatMatchService;
import com.czl.websocket.server.WebSockeManger;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 石雷
 * shilei1@jiayuan.com
 * 2021/1/22/022 14:58
 */
@RestController
@RequestMapping("/ChatMatches")
public class ChatMatchesApi {


    /**
     *  开始匹配
     * @param uid
     * @return
     */
    @RequestMapping("/start")
    public RestApiResult start(String uid){
        ChatMatchService.start(uid);
        return RestApiResult.create(RestApiResult.RetCode.SUCCESS.getValue(),RestApiResult.RetCode.SUCCESS.getInfo());
    }

    /**
     * 取消匹配
     * @param uid
     * @return
     */
    @RequestMapping("/stop")
    public RestApiResult stop(String uid){
        ChatMatchService.stop(uid);

        return RestApiResult.create(RestApiResult.RetCode.SUCCESS.getValue(),RestApiResult.RetCode.SUCCESS.getInfo());
    }
}
